#include <iostream>
using namespace std;
int BSerch(int n,int a[],int k)
{ int low=0;
  int high=n-1;
  int mid;
 while (low<=high)
   { mid=(low+high)/2;
   	if(a[mid]==k) {cout<<mid;break;
	   }
   	else if(a[mid]>k) 
	  {
	    high=mid-1;
	  } 
   	else if(a[mid]<k) 
	   {
	     low=mid+1;
	   }
   }
return -1;
}
int main()
{ int a[]={1,2,3,4,5,6,8,9,10,50};
	int k;
	cout<<"k=";
	cin>>k;
	int n=10;
	BSerch(n,a,k);
}


